home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / add304.zip / ADD.DOC next >
Text File  |  1993-03-20  |  5KB  |  127 lines

  1. ADD.DOC
  2. 03/20/93
  3.  
  4. The ADD.EXE program goes through a text file and adds up the numbers in specific
  5. columns.  Invalid characters are ignored in the records (only digits, the
  6. decimal place, and the negative sign are processed).  The routine presents some
  7. summary information about your file and also provides a relatively quick way of
  8. getting a record count for your file.
  9.  
  10.         Records in:      ###
  11.         Addable records: ###
  12.           SUM:           ###
  13.           Minimum:       ###
  14.           Maximum:       ###
  15.  
  16.  
  17. Syntax:
  18.  
  19. The routine requires at least one parameter (the name of the text file to
  20. process) but also has other options:
  21.  
  22.     ADD infile [ /COLUMNS { col1-col2 | col1 colct } ]
  23.       [ /LINES { line1-line2 | line1 linect } ... ]
  24.       [ /V | /-V ] [ /I | /-I ] [ search ]
  25.       [ /C | /-C ] [ /Q ] [ /? ]
  26.  
  27. where:
  28.  
  29. "infile" is the name of the file to process.
  30.  
  31. "/COLUMNS col1-col2" says to restrict the search of that file to just those
  32. numbers found in the columns between col1 and col2 inclusive.  So "ADD MYFILE
  33. /COLUMNS 1-10" would confine the search to just the numbers found in the first
  34. 10 characters of each record.  Defaults to "/COLUMNS 1-100".
  35.  
  36. "/COLUMNS col1 colct" says to restrict the search of that file to just those
  37. numbers found in the colct columns beginning with col1.  For example, "ADD
  38. MYFILE /COLUMNS 10 5" will confine the search to just those numbers found in
  39. columns 10 to 14 (the 5 columns beginning will column 10) of each record.
  40.  
  41.  
  42. "/LINES line1-line2" says to restrict the search to lines between line numbers
  43. line1 and line2 inclusive.  You can have multiple line requests in any order
  44. such as "/LINES 1-10 90-100 30-50".  The routine skips all lines after the
  45. largest line number is encountered.  Defaults to "/LINES 1-9999999".
  46.  
  47. "/LINES line1 linect" says to restrict the search to lines beginning with line1
  48. and continuing for a total of linect lines.  So "/LINES 10 20" is actually the
  49. same as "/LINES 10 29".
  50.  
  51. "/V" says to find those items that do NOT match the specification.
  52.  
  53. "/-V" is the opposite of /V and is typically the default; CONFIGWS-able.
  54.  
  55. "/I" says to make it a case-insensitive search.
  56.  
  57. "/-I" is the opposite of /I and is typically the default; CONFIGWS-able.
  58.  
  59. "search" restricts the search to lines which meet some string search
  60. specification.  The search itself is described below.
  61.  
  62. "/C" skips adding up numbers in the file and simply gives you a record count for
  63. the file.  /C and /COLUMNS are mutually exclusive; don't try both of them at
  64. once.  /C operates very quickly if no string search or line restriction is made;
  65. it reads the file in in blocks and search for carriage return/line feed
  66. sequences.
  67.  
  68. "/-C" is the opposite of /C and is typically the default; CONFIGWS-able.
  69.  
  70. "/Q" turns off the block-by-block status messages.
  71.  
  72. "/?" or "/HELP" or "HELP" shows you the syntax for the command.
  73.  
  74.  
  75. For search, the syntax is:
  76.   [ ( ]... search_item [ boolean [ ( ]... search_item [ ) ]...] [ ) ]...
  77. where:
  78.   ( and )     are used to group items
  79.   search_item is shown below
  80.   boolean     is AND, OR, or XOR (NOT is included with search_item)
  81.  
  82. for search_item, the syntax is:
  83.   [ NOT ]  "string" [ column ]
  84. where:
  85.   NOT         is obvious
  86.   string      the string to search; the quotation marks are typically not
  87.               required unless the string contains a space or a reserved word
  88.   column      is the column in which the string must be found.
  89.  
  90. So, let's cover some examples:
  91.  
  92.         ADD TEST.TXT "Bugs Bunny" OR "Elmer Fudd" /COLS=1-10
  93.  
  94. Adds any numeric values in columns 1 to 10 in TEST.TXT that have the either the
  95. text "Bugs Bunny" or "Elmer Fudd" in them.
  96.  
  97.         ADD TEST2.TXT (Apples or Oranges) AND NOT Pears /LINES=1-1000 /COLS=1/5
  98.  
  99. Adds any data in columns 1 to 5 of the first thousand lines of TEST2.TXT.  The
  100. line itself must contain the words "Apples" or "Oranges" in them and any lines
  101. are ignored that contain "Pears".  Note that the quotes around the search words
  102. are not required unless the words include spaces or unless they could be
  103. confused with some other keywords.  "ADD TEST3.TXT OR OR AND" might cause the
  104. program to get confused since "OR" and "AND", which you want to look for as also
  105. keywords.
  106.  
  107.         ADD /I TEST.TXT "Bugs Bunny" AND Martians /C
  108.  
  109. Gives you the number of lines containing both "Bugs Bunny" and "Martians".  The
  110. search is case-insensitive so lines with either "BUGS BUNNY" or "Bugs Bunny"
  111. will be included.  No addition is done since /C is provided.
  112.  
  113.  
  114. This program was written by Bruce Guthrie of Wayne Software.  It is free for use
  115. provided relevant documentation is kept with the program, no changes are made to
  116. the program or documentation, and it is not bundled with commercial programs or
  117. charged for separately.  People who need to bundle it in for-sale packages must
  118. pay a $50 registration fee to "Wayne Software" at the following address.
  119. Comments and suggestions can also be sent to:
  120.  
  121.                 Bruce Guthrie
  122.                 Wayne Software
  123.                 113 Sheffield St.
  124.                 Silver Spring, MD 20910
  125.  
  126.                 fax: (301) 588-8986
  127.